function structNew=replaceNamesStruct(struct,structTwo,fields)
% Given the structure struct create a new structure structNew with 
% fieldnames in fields either using those in struct or replacing them with the corresponding
% fields in structTwo 
% Use to create tablesforNames
% structNames=fieldnames(struct); 
Nreplace=length(fields); 
for ii=1:Nreplace
    fldnm=fields{ii}; 
    if isfield(structTwo,fldnm)==true 
        temp=fieldnamesReplace(struct.(fldnm),structTwo.(fldnm)); 
        structNew.(fldnm)=temp; 
    else 
        structNew.(fldnm)=struct.(fldnm); 
    end 
end 
        
    
